home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.04 Apr 90 / Messenger Files / dDriver Folder / About.c next >
Encoding:
C/C++ Source or Header  |  1990-01-17  |  2.1 KB  |  98 lines  |  [TEXT/KAHL]

  1. /* *******************************
  2.  
  3. File: About.c
  4. Function: Handle all operations for this Modal Dialog
  5. History: 10/3/89 by Kirk Chase.  
  6.  
  7. ******************************* */
  8.  
  9. #include "About.h"
  10. #include "String.h"
  11. #include "Messenger.h"
  12.  
  13. pascal Boolean AboutFilter(itemHit, dptr)
  14. int itemHit;
  15. DialogPtr dptr;
  16. {
  17. return TRUE;
  18. }
  19.  
  20. pascal Boolean ExampleFilter(itemHit, dptr)
  21. int itemHit;
  22. DialogPtr dptr;
  23. {
  24. int itemType;
  25. Handle item;
  26. Rect box;
  27.  
  28. if (itemHit == 2) {
  29.     ParamText("\pThis is changed","\pfor YOUR benefit.", "\p","\pOk?");
  30.     GetDItem(dptr, 3, &itemType, &item, &box);
  31.     InvalRect(&box);
  32.     GetDItem(dptr, 2, &itemType, &item, &box);
  33.     HiliteControl((ControlHandle) item, 255);
  34.     InvalRect(&box);
  35.     }
  36.     
  37. return FALSE;
  38. }
  39.  
  40. void D_About()
  41. {
  42. DialogInfo AboutInfo, oldInfo;
  43. int dummy;
  44. ProcPtr theFilter;
  45.  
  46. GetMInfo(&oldInfo);
  47.  
  48. theFilter = (ProcPtr) &AboutFilter;
  49.  
  50. AboutInfo.defaultItem = 1;
  51. AboutInfo.Buttons = 1;
  52. AboutInfo.dPlace = THIRD;
  53. AboutInfo.dIcon = noIcon;
  54. SetRect(&AboutInfo.Button1Rect, 0, 0, 80, 20);
  55. SetRect(&AboutInfo.TextRect, 0, 0, 140, 30);
  56. SetRect(&AboutInfo.dRect, 0, 0, 200, 150);
  57. AboutInfo.Arrange = HORIZONTAL;
  58. AboutInfo.AddFilter = theFilter;
  59. strcpy((char *) &AboutInfo.Button1, "\pOK");
  60. strcpy((char *) &AboutInfo.CharEquiv, "\poOoOoO");
  61.  
  62. SetMInfo(AboutInfo);
  63.  
  64. dummy = DoMessage("\pMessenger by Kirk Chase", "\p© 1989 by Kirk Chase", "\pand MacTutor", "\p");
  65.  
  66. SetMInfo(oldInfo);
  67. }
  68.  
  69. void D_Example()
  70. {
  71. DialogInfo ExampleInfo, oldInfo;
  72. int dummy;
  73. ProcPtr theFilter;
  74.  
  75. GetMInfo(&oldInfo);
  76.  
  77. theFilter = (ProcPtr) &ExampleFilter;
  78.  
  79. ExampleInfo.defaultItem = 1;
  80. ExampleInfo.Buttons = 2;
  81. ExampleInfo.dPlace = THIRD;
  82. ExampleInfo.dIcon = noIcon;
  83. SetRect(&ExampleInfo.Button1Rect, 0, 0, 50, 20);
  84. SetRect(&ExampleInfo.Button2Rect, 0, 0, 100, 20);
  85. SetRect(&ExampleInfo.TextRect, 0, 0, 140, 30);
  86. SetRect(&ExampleInfo.dRect, 0, 0, 300, 100);
  87. ExampleInfo.Arrange = VERTICAL;
  88. ExampleInfo.AddFilter = theFilter;
  89. strcpy((char *) &ExampleInfo.Button1, "\pOK");
  90. strcpy((char *) &ExampleInfo.Button2, "\p Change Text");
  91. strcpy((char *) &ExampleInfo.CharEquiv, "\poOcCoO");
  92.  
  93. SetMInfo(ExampleInfo);
  94.  
  95. dummy = DoMessage("\pExample", "\pThis is another", "\pexmaple of", "\pMessenger");
  96.  
  97. SetMInfo(oldInfo);
  98. }